package com.lanou3g.code0413.stream;

/**
 * If there are no bugs, it was created by Chen FengYao on 2018/4/13;
 * Otherwise, I don't know who created it either
 */

public class Test02 {
    public static void main(String[] args) {
        int a = fun1();
        System.out.println(a);
    }

    public static int fun1(){
        int a = 3;

        try {
            return a;
        } catch (Exception e){
            return 4;
        } finally {
            a = 5;
            System.out.println("finally:" + a);
            return a;
        }
    }


    public static int fun(){
        int a = 3;
        try {
            a = 4 / 0;
        } catch (Exception e){
            a = 5 / 0;
        } finally {
            // finally可以保证,无论什么情况
            // 里面的代码一定会被执行
            // 通常就是用来释放资源(关流)
            a = 6;
        }
        return a;
    }
}
